#ifndef GLOBALSTYLE_H
#define GLOBALSTYLE_H

#include <QObject>
#include <QDebug>

class GlobalStyle : public QObject
{
    Q_OBJECT

public:
    // 获取全局实例
    static GlobalStyle& getInstance() {
        static GlobalStyle instance;
        return instance;
    }

    QString getStyle(int index, int size)
    {
        QString style;
        QString fontSize;
        QString small = "font: 18px;";
        QString middle = "font: 24px;";
        QString big = "font: 30px;";
        switch (size) {
        case 0:
            //小号字体
            fontSize = small;
           break;
        case 1:
            //中号字体
            fontSize = middle;
           break;
        case 2:
            //大号字体
            fontSize = big;
           break;
        default:
            break;
        }
        switch (index)
        {
        case 0:
            //黑白
            style =
                    "QPushButton{" + fontSize + "color: #2f3640; background-color: #f5f6fa; border-color: #2f3640; border-radius: 15px;border-style: solid;border-width: 4px; padding: 5px;}"
                    "QPushButton::hover{font: 32px; color: #FFFFFF; background-color: #718093; border-color: #2f3640;}"
                    "QPushButton::pressed,QPushButton::checked{color: #FFFFFF;background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #273c75, stop:1 #487eb0);}QPushButton::disabled{ color: #FFFFFF;background-color: #dcdde1;border-color: #dcdde1;}"
                    "QListView {icon-size: 48px;text-align: center;" + fontSize + "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 black, stop: 1 #333333); color: white;border: none;}"
                    "QListView::item {border-bottom: 3px solid #666666; padding: 5px; height:80px}"
                    "QListView::item:hover {background-color: #ffffff; color: #000000; margin: -15px;}"
                    "QLabel{background: none; " + fontSize + " color: black;}"
                    "QComboBox {" + fontSize + "border-radius: 3px;padding: 1px 18px 1px 3px;background: transparent; border: 1px solid gray;color: #ffffff;border-color:#E5E5E5;background-color: darkGray;}"
                    "QComboBox:on {color: #ffffff;background-color: black;}"
                    "QSlider::groove:horizontal {border: 0px solid #bbb;}QSlider::sub-page:horizontal {background: #000000;border-radius: 2px;margin-top:8px;margin-bottom:8px;}"
                    "QSlider::add-page:horizontal {background: rgb(193,204,208);border: 0px solid #777;border-radius: 2px;margin-top:9px;margin-bottom:9px;}"
                    "QSlider::handle:horizontal {background: rgb(193,204,208);width: 9px;border: 1px solid rgb(193,204,208);border-radius: 2px; margin-top:6px;margin-bottom:6px;}"
                    "QSlider::hsandle:horizontal:hover {background: rgb(193,204,208);width: 19px;border: 1px solid rgb(193,204,208);border-radius: 5px; margin-top:4px;margin-bottom:4px;}"
                    "QTextEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}"
                    "QLineEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}";
            break;
        case 1:
            // 绿白
            style =
                    "QPushButton { " + fontSize + " color: #008000; background-color: #FFFFFF; border-color: #006400; border-radius: 15px; border-style: solid; border-width: 4px; padding: 5px; } "
                    "QPushButton::hover { font: 28px; color: #FFFFFF; background-color: #32CD32; border-color: #006400; } "
                    "QPushButton::pressed, QPushButton::checked { color: #FFFFFF; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFFF, stop:1 #006400); } "
                    "QPushButton::disabled { color: #FFFFFF; background-color: #dcdde1; border-color: #dcdde1; } "
                    "QListView { icon-size: 48px; text-align: center; " + fontSize + " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 	#696969, stop:1 #006400); color: #ffffff; border: none; } "
                    "QListView::item { border-bottom: 3px solid #008000; padding: 5px; height: 80px; } "
                    "QListView::item:hover { background-color: #32CD32; color: #000000; margin: -15px; } "
                    "QLabel { background: none; " + fontSize + " color: #008000; } "
                    "QComboBox {" + fontSize + " border-radius: 3px; padding: 1px 18px 1px 3px; background: transparent; border: 1px solid gray; color: #333333; border-color: #E5E5E5; background-color: #FFFFFF; }"
                    "QComboBox:on { color: #008000; background-color: #32CD32; }"
                    "QSlider::groove:horizontal { border: 0px solid #bbb; } "
                    "QSlider::sub-page:horizontal { background: #32CD32; border-radius: 2px; margin-top: 8px; margin-bottom: 8px; } "
                    "QSlider::add-page:horizontal { background: #ffffff; border: 0px solid #777; border-radius: 2px; margin-top: 9px; margin-bottom: 9px; } "
                    "QSlider::handle:horizontal { background: #FFFFFF; width: 9px; border: 1px solid #006400; border-radius: 2px; margin-top: 6px; margin-bottom: 6px; } "
                    "QSlider::handle:horizontal:hover { background: #FFFFFF; width: 19px; border: 1px solid #006400; border-radius: 5px; margin-top: 4px; margin-bottom: 4px; }"
                    "QTextEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}"
                    "QLineEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}";
            break;
        case 2:
            //白黑
            style =
                    "QPushButton {" + fontSize + "color: #000000;background-color: #FFFFFF;border-color: #000000;border-radius: 15px;border-style: solid;border-width: 4px;padding: 5px;}"
                    "QPushButton::hover {font: 28px;color: #FFFFFF;background-color: #666666;border-color: #000000;}"
                    "QPushButton::pressed, QPushButton::checked {color: #FFFFFF;background-color: #333333;}"
                    "QPushButton::disabled {color: #888888;background-color: #dcdde1;border-color: #dcdde1;}"
                    "QListView {icon-size: 48px;text-align: center;" + fontSize + "background: #FFFFFF;color: #000000;border: none;}"
                    "QListView::item {border-bottom: 3px solid #666666;padding: 5px;height: 80px;}"
                    "QListView::item:hover {background-color: #666666;color: #FFFFFF;margin: -15px;}"
                    "QLabel {background: none;" + fontSize + "color: #ffffff;}"
                    "QComboBox {" + fontSize + "border-radius: 3px;padding: 1px 18px 1px 3px;background: transparent;border: 1px solid gray;color: #333333;border-color: #E5E5E5;background-color: #FFFFFF;}"
                    "QComboBox:on {color: #000000;background-color: #666666;}"
                    "QSlider::groove:horizontal {border: 0px solid #bbb;}"
                    "QSlider::sub-page:horizontal {background: #666666;border-radius: 2px;margin-top: 8px;margin-bottom: 8px;}"
                    "QSlider::add-page:horizontal {background: #888888;border: 0px solid #777;border-radius: 2px;margin-top: 9px;margin-bottom: 9px;}"
                    "QSlider::handle:horizontal {background: #FFFFFF;width: 9px;border: 1px solid #000000;border-radius: 2px;margin-top: 6px;margin-bottom: 6px;}"
                    "QSlider::handle:horizontal:hover {background: #FFFFFF;width: 19px;border: 1px solid #000000;border-radius: 5px;margin-top: 4px;margin-bottom: 4px;}"
                    "QTextEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}"
                    "QLineEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}";
            break;
        case 3:
            //红白
            style =
                    "QPushButton{" + fontSize + "color: #FF69B4;background-color: #FF0000;border-color: #FF69B4;border-radius: 15px;border-style: solid;border-width: 4px;padding: 5px;}"
                    "QPushButton::hover{font: 28px; color: #FFFFFF;background-color: #FF1493;border-color: #FF69B4;}"
                    "QPushButton::pressed,QPushButton::checked{color: #FFFFFF;background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #FF0000, stop:1 #FF69B4);}"
                    "QPushButton::disabled{color: #FFFFFF;background-color: #dcdde1;border-color: #dcdde1;}"
                    "QListView{" + fontSize + "icon-size: 48px;text-align: center;background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #FF0000, stop:1 #FF69B4);color: white;border: none;}"
                    "QListView::item{border-bottom: 3px solid #666666;padding: 5px;height: 80px;}"
                    "QListView::item:hover{background-color: #ffffff;color: #000000;margin: -15px;}"
                    "QLabel{" + fontSize + "background: none;color: #FF0000;}"
                    "QComboBox{" + fontSize + "border-radius: 3px;padding: 1px 18px 1px 3px;background: transparent;border: 1px solid gray;color: #333333;border-color: #E5E5E5;background-color: #FF69B4;}"
                    "QComboBox:on{color: #ffffff;background-color: #FF0000;}"
                    "QSlider::groove:horizontal{border: 0px solid #bbb;}"
                    "QSlider::sub-page:horizontal{background: #FF69B4;border-radius: 2px;margin-top: 8px;margin-bottom: 8px;}"
                    "QSlider::add-page:horizontal{background: #ffffff;border: 0px solid #777;border-radius: 2px;margin-top: 9px;margin-bottom: 9px;}"
                    "QSlider::handle:horizontal{background: #FF1493;width: 9px;border: 1px solid #FF1493;border-radius: 2px;margin-top: 6px;margin-bottom: 6px;}"
                    "QSlider::handle:horizontal:hover{background: #FF1493;width: 19px;border: 1px solid #FF1493;border-radius: 5px;margin-top: 4px;margin-bottom: 4px;}"
                    "QTextEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}"
                    "QLineEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}";
            break;
        case 4:
            //黄蓝
            style =
                    "QPushButton {" + fontSize + "color: #FFA500;background-color: #0099CC;border-color: #FFA500; border-radius: 15px;border-style: solid;border-width: 4px;padding: 5px;}"
                    "QPushButton::hover {font: 32px;color: #FFFFFF; background-color:#FFD700;border-color: #FFA500; }"
                    "QPushButton::pressed, QPushButton::checked {color: #FFFFFF;background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #FFA500, stop:1 #0099CC); }"
                    "QPushButton::disabled {color: #FFFFFF;background-color: #dcdde1;border-color: #dcdde1;}QListView {icon-size: 48px;text-align: center;font: 24px;background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 #FFA500, stop:1 #0099CC);color: white;border: none;}"
                    "QListView::item {" + fontSize + "border-bottom: 3px solid #666666;padding: 5px;height: 80px;}"
                    "QListView::item:hover {background-color: blue;color: yellow;margin: -15px;}QLabel {background: none;font: 24px;color: black;}"
                    "QComboBox {" + fontSize + "border-radius: 3px;padding: 1px 18px 1px 3px;background: transparent;border: 1px solid gray;color: #333333;border-color: #E5E5E5; background-color: #FFA500;}QComboBox:on { color: #ffffff; background-color: #FFA500; }QSlider::groove:horizontal { border: 0px solid #bbb;}QSlider::sub-page:horizontal {background: #0099CC; border-radius: 2px;margin-top: 8px; margin-bottom: 8px;}"
                    "QSlider::groove:horizontal {border: 0px solid #bbb;}QSlider::sub-page:horizontal {background: #FFA500;border-radius: 2px;margin-top:8px;margin-bottom:8px;}"
                    "QSlider::add-page:horizontal {background: rgb(255,255, 255);border: 0px solid #777;border-radius: 2px;margin-top:9px;margin-bottom:9px;}"
                    "QSlider::handle:horizontal {background: rgb(193,204,208);width: 9px;border: 1px solid rgb(193,204,208);border-radius: 2px; margin-top:6px;margin-bottom:6px;}"
                    "QSlider::handle:horizontal:hover {background: rgb(193,204,208);width: 19px;border: 1px solid rgb(193,204,208);border-radius: 5px; margin-top:4px;margin-bottom:4px;}"
                    "QLabel {background: none;" + fontSize + "color: #FFA500;}"
                    "QTextEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}"
                    "QLineEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}";
            break;
        case 5:
            //黑红
            style =
                    "QPushButton { " + fontSize + "color: #000000; background-color: #8B0000; border-color: #000000; border-radius: 15px; border-style: solid; border-width: 4px; padding: 5px; }"
                    "QPushButton::hover { font: 28px; color: #ffffff; background-color: #FF1493; border-color: #000000; }"
                    "QPushButton::pressed, QPushButton::checked { color: #FFFFFF; background-color: qlineargradient(spread: pad, x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF0000, stop: 1 #FF69B4); }"
                    "QPushButton::disabled { color: #888888; background-color: #dcdde1; border-color: #dcdde1; }"
                    "QListView { icon-size: 48px; text-align: center; " + fontSize + " background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #8B0000, stop: 1 #B22222); color: white; border: none; }"
                    "QListView::item { border-bottom: 3px solid #666666; padding: 5px; height: 80px; }"
                    "QListView::item:hover { background-color: #000000; color: red; margin: -15px; }"
                    "QLabel { background: none; " + fontSize + " color: #DC143C; }"
                    "QComboBox { " + fontSize + " border-radius: 3px; padding: 1px 18px 1px 3px; background: transparent; border: 1px solid gray; color: #333333; border-color: #E5E5E5; background-color: #8B0000; }"
                    "QComboBox:on { color: #ffffff; background-color: #FF0000; }"
                    "QSlider::groove:horizontal { border: 0px solid #bbb; }"
                    "QSlider::sub-page:horizontal { background: #FF69B4; border-radius: 2px; margin-top: 8px; margin-bottom: 8px; }"
                    "QSlider::add-page:horizontal { background: #ffffff; border: 0px solid #777; border-radius: 2px; margin-top: 9px; margin-bottom: 9px; }"
                    "QSlider::handle:horizontal { background: #FF1493; width: 9px; border: 1px solid #FF1493; border-radius: 2px; margin-top: 6px; margin-bottom: 6px; }"
                    "QSlider::handle:horizontal:hover { background: #FF1493; width: 19px; border: 1px solid #FF1493; border-radius: 5px; margin-top: 4px; margin-bottom: 4px; }"
                    "QTextEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}"
                    "QLineEdit{font: 75 22pt ;border: 3px solid #000000; background-color: #F0F0F0;}";
            break;
        default:
            break;
        }
        return style;
    }

private:
    // 私有构造函数，防止外部创建实例
    GlobalStyle() {}


};

#endif // GLOBALSTYLE_H
